const zmq = require("zeromq")


async function startSub(address) {
    const sock = new zmq.Subscriber()

    sock.connect(address)
    sock.subscribe("dnet")
    console.log("Subscriber connected to ", address)

    for await (let [topic, msg] of sock) {
        // 把topic和msg转化为UTF8输出
        topic = topic.toString("utf8")
        msg = msg.toString("utf8")
        console.log(
            address,
            topic,
            msg,
        )
    }
}
startSub("tcp://10.0.8.204:22222");
startSub("tcp://10.0.8.50:22222");
startSub("tcp://52.197.198.21:22222");